import os
import collect
import time
import datetime
import insert_sql


if __name__ == '__main__':
    while 1:
        collect.test_collect()
        try:
            insert_sql.json_insert_violation_data_table()
            insert_sql.json_insert_violation_sealing_data_table()
            os.remove("Violation_data_table.json")
            os.remove("Violation_Sealing_table.json")
            print("违规数据 全部写入mysql库")
        except (OSError, AttributeError):
            print("今日没有违规数据 写入mysql库")
        print("{0} .., 10分钟后重新运行".format(datetime.datetime.now()))
        time.sleep(600)
